package StudyCode.summary.zipfile;

import java.io.IOException;
import java.net.URI;
import java.nio.file.*;
import java.util.HashMap;
import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UseZIPFileSystemToCopy {
	public static void main(String[] args) throws IOException {
		Map<String, String> env = new HashMap<>();
		env.put("create", "false");
		env.put("encoding", "ISO-8859-1");
		URI uri = URI.create("jar:file://E:/Copy/1.zip");
		try (FileSystem ZipFS = FileSystems.newFileSystem(uri, env)) {
			Path fileInZip = ZipFS.getPath("/test.png");
			Path fileOutZip = Paths.get("e:/Copy/Copy.png");
			Files.copy(fileInZip, fileOutZip);
			System.out.println("文件复制成功!");
		}
	}
}
